package cn.explink.distributor.framework;

import java.util.List;

public class CommonCondition implements Condition {

	private static final long serialVersionUID = -7825260297804970741L;

	private String id;

	private String name;

	/**
	 * 分单条件的优先级
	 */
	private int priority;

	/**
	 * 分单条件的权重
	 */
	private int weight;

	private int type;

	public CommonCondition() {
	}

	public CommonCondition(String name, int priority, int weight) {
		this.name = name;
		this.priority = priority;
		this.weight = weight;
	}

	@Override
	public boolean isMatched(Condition condition) {
		return true;
	}

	@Override
	public boolean isComparableMatched(Condition orderCondition, List<Target> targetList) {
		return true;
	}

	@Override
	public final int compareTo(Condition condition) {
		if (this.priority > condition.getPriority()) {
			return -1;
		} else if (this.priority < condition.getPriority()) {
			return 1;
		} else {
			return 0;
		}
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	@Override
	public int getPriority() {
		return this.priority;
	}

	@Override
	public int getWeight() {
		return this.weight;
	}

	public void setWeight(int weight) {
		this.weight = weight;
	}

	@Override
	public int getType() {
		return this.type;
	}

	public void setType(int type) {
		this.type = type;
	}

}
